name: Publish
on:
  push:
    branches:
      - main

jobs:
  publish:
    runs-on: ubuntu-latest

    permissions:
      contents: read
      id-token: write

    steps:
      - uses: actions/checkout@v4

      - name: Publish @llamaindex/env
        run: npx jsr publish
        working-directory: packages/env
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Publish @llamaindex/core
        run: npx jsr publish --allow-slow-types
        working-directory: packages/core
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
